import Vue from 'vue'

import Cookies from 'js-cookie'

import 'normalize.css/normalize.css'

import Element from 'element-ui'
import locale from 'element-ui/lib/locale/lang/en'

import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/antd.css'
//
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'

// 权限指令
import permission from './components/Permission'
import './assets/styles/element-variables.scss'
// global css
import './assets/styles/index.scss'
import './assets/styles/common/width.scss'
import './assets/styles/common/flex.scss'
import './assets/styles/common/distance.scss'
// 代码高亮
import VueHighlightJS from 'vue-highlightjs'
import 'highlight.js/styles/atom-one-dark.css'

import App from './App'
import store from './store'
import router from './router/routers'

import filters from './utils/filters'

import './assets/icons' // icon
import './router/index' // permission control
import 'echarts-gl'
import iView from 'iview'
import 'iview/dist/styles/iview.css'
import { create } from '@/config';
create(Vue);

Vue.use(iView)

import Print from "./utils/print"
Vue.use(Print)

Vue.use(Antd)
Vue.use(VueHighlightJS)
Vue.use(mavonEditor)
Vue.use(permission)
Vue.use(Element, {
    size: Cookies.get('size') || 'small' // set element-ui default size
    // locale, 注销之后默认显示中文
})

Object.keys(filters).forEach(k => Vue.filter(k, filters[k]))
Vue.config.productionTip = false;

Vue.prototype.$BUS = new Vue();

// Vue.directive('integer-only', {
//     // 当绑定元素插入到DOM中
//     mounted(el) {
//         el.addEventListener('input', event => {
//             const value = event.target.value;
//             event.target.value = value.replace(/\D/g, ''); // 只保留数字
//         });
//     }
// })


new Vue({
    el: '#app',
    router,
    store,
    render: h => h(App)
})
